# 构建镜像
# FROM zw-main-registry.cn-shanghai.cr.aliyuncs.com/zw-image-base/build-stage-vue-cnpm:latest as build-stage
FROM zw-main-registry-vpc.cn-shanghai.cr.aliyuncs.com/zw-image-base/build-stage-vue-cnpm:latest as build-stage
ARG STAGE
COPY ./ /tmp/build/
WORKDIR /tmp/build/
COPY package-${STAGE}.json package.json
RUN npm install
RUN npm run build:${STAGE}

# VUE NGINX 运行时镜像
# FROM zw-main-registry.cn-shanghai.cr.aliyuncs.com/zw-image-base/env-nginx-for-vue-dist:latest
FROM zw-main-registry-vpc.cn-shanghai.cr.aliyuncs.com/zw-image-base/env-nginx-for-vue-dist:latest
ARG STAGE
RUN mkdir -p /data/www/m.scrm.keyid.cn/
RUN mkdir -p /data/logs/nginx/
COPY --from=build-stage /tmp/build/dist /data/www/home.scrm.keyid.cn/
ADD ./deploy/${STAGE}/home.scrm.keyid.cn.conf /etc/nginx/conf.d/home.scrm.keyid.cn.conf